import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { SGangFightsTeam } from "../../../../../Message/Public/SGangFightsTeam";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GangFightsTeamMsgWindow } from "../GangFightsTeamMsgWindow";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class GangFightsApplyTeamCellRenderer
    
    export  class GangFightsApplyTeamCellRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            var loc1=GlobalStyle.textFormat1;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._tfRank = ObjCreate.createTextField("", 0, 12, 60, 20, this, loc1);
            this._tfTeamName = ObjCreate.createTextField("", 60, 12, 180, 20, this, loc1);
            this._tfTeamCaptainNam = ObjCreate.createTextField("", 240, 12, 180, 20, this, loc1);
            this._tfScore = ObjCreate.createTextField("", 420, 12, 60, 20, this, loc1);
            this._tfWerfare = ObjCreate.createTextField("", 480, 12, 80, 20, this, loc1);
            this._tfTeamNum = ObjCreate.createTextField("", 560, 12, 80, 20, this, loc1);
            this._btnApply = ObjCreate.createGButton(Language.getString(44418), 660, 10, 70, 22, this);
            this._btnLook = ObjCreate.createGButton(Language.getString(44419), 735, 10, 50, 22, this);
            ObjCreate.createBg(0, 40, 790, 2, this, "SplitLine");
            this._btnApply.addEventListener(flash.events.MouseEvent.CLICK, this.onClickApply);
            this._btnLook.addEventListener(flash.events.MouseEvent.CLICK, this.onClickLook);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "sgangfightsteam") 
            {
                this._team = arg1 as SGangFightsTeam;
                this.updateView();
            }
            return;
        }

        /* internal  */onClickApply(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GangFightsApplyTeam, this._team.teamId));
            return;
        }

        /* internal  */onClickLook(arg1: Object /* flash.events.MouseEvent */): void
        {
            GangFightsTeamMsgWindow.instance.show();
            Dispatcher.dispatchEvent(new DataEvent(EventName.GangFightsGetTeamOtherInfo, this._team.teamId));
            return;
        }

        /* internal  */updateView(): void
        {
            if (this._team) 
            {
                this._tfRank.text = this._team.rank.toString();
                this._tfTeamName.text = this._team.name.toString();
                this._tfTeamCaptainNam.text = this._team.captainName.toString();
                this._tfScore.text = this._team.mark.toString();
                this._tfWerfare.text = this._team.warfare.toString();
                this._tfTeamNum.text = this._team.memberNum.toString();
            }
            return;
        }

        /* internal */ /* var */_tfRank: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTeamName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTeamCaptainNam: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfScore: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfWerfare: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTeamNum: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnApply: GButton;

        /* internal */ /* var */_btnLook: GButton;

        /* internal */ /* var */_team: SGangFightsTeam;
    }
